<template>
	<div>
		<audio :ref="audio.messageId" controls="controls" :src='real_path'></audio>
	</div>
</template>

<script>
	export default {
		name: 'm-audio',
		props: ["audio"],
		data() {
			return {
				real_path:""
			}
		},
		computed: {
			myInfo() {
				return this.$store.state.myInfo
			}
		},
		methods: {
			getCaption(obj) {
				let index = obj.lastIndexOf(`"file":`);
				obj = obj.substring(index + 9, obj.length - 2);
				//  console.log(obj);
				return obj;
			},
			get_real_path(url){
				let reg = /\\/g
				let res = url.replace(/\\/g,"/")
				res = res.replace("http:","http://")
				console.log(res)
				return res
			}
		},
		mounted() {
//			console.log('audio  start')
//			let info = this.$shell("GetFileStream", [this.myInfo.id, this.audio.value])
//			console.log(info)
//			let res = this.getCaption(info);
//			console.log(res)
//			console.log(this.audio)
//			this.$downLoad("api/v1/oim/file/download.do",this.audio.DownLoadId,(res)=>{
//				console.log("audio down res")
//				console.log(res)
//				this.$refs[this.audio.messageId].src = res
//			},()=>{
//				
//			})
//			let res = encodeURI(this.audio.value)
//			console.log(res)
		},
		created() {
			this.real_path = this.get_real_path(this.audio.isDownLoad)
		}
	}
</script>

<style>

</style>